#!/usr/bin/python

import sqlite as sql
import os

os.unlink("simple.db");

conn = sql.connect("simple.db")
c = conn.cursor()

c.execute('''create table stocks
	(date text, trans text, symbol text, qty real, price real)''')

purchases = [('2006-03-28', 'BUY', 'IBM', 1000, 45.00),
	  ('2006-04-05', 'BUY', 'MSFT', 1000, 72.00),
	  ('2006-04-06', 'SELL', 'IBM', 500, 53.00)
	  ]
c.executemany('INSERT INTO stocks VALUES (%s, %s, %s, %d, %f)', purchases)

#for row in c.execute('select * from stocks order by price'):
#	print row

row = c.execute('select * from stocks order by price')
for row in c.fetchall():
	print row
